package cn.tedu.oss.controller;

import cn.tedu.commonUtils.R;
import cn.tedu.oss.service.OssService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/eduoss/fileoss")
@CrossOrigin
public class OssController {

    @Autowired
    private OssService ossService;

    @ApiOperation("oss上传文件")
    @PostMapping("/upload")
    public R uploadAvatar(MultipartFile file){
        String url = ossService.uploadAvatar(file);
        return R.ok().data("url",url);
    }
}
